// <copyright file="RadioButtonItem.cs" company="YUIAsp.Net">
// Copyright (c) 2009 All Right Reserved
// </copyright>
// <author>raul popescu</author>
// <email>dev@yuiasp.net</email>
// <date>2009-01-30</date>
// <summary>YUIAsp.Net File</summary>

using System;
using System.ComponentModel;
using System.Web.UI;

namespace YUIAspNet
{
    /// <summary>
    /// Represents a RadioButton.
    /// </summary>
    [ToolboxItem(false)]
    public class RadioButtonItem : Control
    {
        bool _checked;


        /// <summary>
        /// Occurs when [reset check].
        /// </summary>
        public event EventHandler ResetCheck;

        #region Public properties
        /// <summary>
        /// Gets or sets the text.
        /// </summary>
        /// <value>The text.</value>
        public string Text { get; set; }

        /// <summary>
        /// Gets or sets the value.
        /// </summary>
        /// <value>The value.</value>
        public string Value { get; set; }

        /// <summary>
        /// Gets or sets the on client click.
        /// </summary>
        /// <value>The on client click.</value>
        public string OnClientClick { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="RadioButtonItem"/> is checked.
        /// </summary>
        /// <value><c>true</c> if checked; otherwise, <c>false</c>.</value>
        public bool Checked
        {
            get { return _checked; }
            set
            {
                if (value && this.ResetCheck != null)
                    this.ResetCheck(this, EventArgs.Empty);

                _checked = value;
            }
        } 
        #endregion
    }
}
